/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


/**
 *
 * @author Administrator
 */


// testing new branch
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

import javax.swing.border.*;

public class CustomerSearch extends JScrollPane  { 
	// User selected Search criteria
	public static String selectedDish  = "";
	public static int selectedPriceRange ;
	
	
	private String[] dishTypes = {"chinese food", "pizza", "italy foos", "swedish food" };
    private String[] price = {"0-100", "100-200", "200+" };
	private JComboBox foodTypeCombo = new JComboBox(dishTypes);
    private JComboBox foodPriceCombo = new JComboBox(price);
    
    // Button to execte command
    private JButton jbtNext = new JButton("Next");

    public CustomerSearch() {
    	JPanel p1 = new JPanel();
    	JPanel p2 = new JPanel();
    	p1.setLayout(new GridLayout(1,2,5,5));
    	p2.setLayout(new FlowLayout(FlowLayout.RIGHT));
    	
    	
    
    	p1.add(foodTypeCombo);
    	p1.add(foodPriceCombo);
    	p2.add(jbtNext);
    
    	p1.setBorder(new TitledBorder("Search criteria"));
    
    	foodTypeCombo.addItemListener( new ItemListener(){
    		public void itemStateChanged(ItemEvent e) {
    			selectedDish = e.getItem().toString();
    		}
    	});
    	
    	
    	/** Switch view to the customer search interface*/
    	jbtNext.addActionListener(new ActionListener(){
    		public void actionPerformed(ActionEvent e){
    			MainFrame.customerCardLayout.show(MainFrame.customerContainer, "searchHits");
    		}
    	});
    	
    	
    	JPanel mainPanel = new JPanel();
    	mainPanel.setLayout(new BorderLayout());
    	mainPanel.add(p1, BorderLayout.NORTH);
    	mainPanel.add(new JLabel(new ImageIcon("image/Search.png")), BorderLayout.CENTER);
    	mainPanel.add(p2, BorderLayout.SOUTH);
    	
    	this.setViewportView(mainPanel);
    }
    
    
    
    private void checkDishTypes(){
    	try{
    		
    		
    	}catch(Exception ex){
    		ex.printStackTrace();
    	}
    }
    
    public void checkprice(int m)
    {
     
    }
    
    
    public static void main(String[] args)  {
    	JFrame frame = new JFrame();
    	CustomerSearch main = new CustomerSearch();
    	frame.add(main);
    	frame.setTitle("my frame");
    	frame.setSize(500,500);
    	frame.setLocationRelativeTo(null);
    	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    	frame.setVisible(true);
    }
}
